/*=====================================================================================================================
 * 
 * Repository path:     $HeadURL: http://sstu.googlecode.com/svn/tags/sstu-v40.23/src/include/triac_control.h $
 * Last committed:      $Revision: 9 $
 * Last changed by:     $Author: vladislav.gyurov@gmail.com $
 * Last changed date:   $Date: 2012-12-12 21:41:22 +0000 (Wed, 12 Dec 2012) $
 * ID:                  $Id: triac_control.h 9 2012-12-12 21:41:22Z vladislav.gyurov@gmail.com $
 *
 *===================================================================================================================*/
#ifndef TRIAC_CONTROL_H
#define TRIAC_CONTROL_H
    
/*----------------------------------------------------------------------------*/
/* Included files to resolve specific definitions in this file                */
/*----------------------------------------------------------------------------*/
#include "basedef.h"
#include "task.h"

/*----------------------------------------------------------------------------*/
/* Constant data                                                              */
/*----------------------------------------------------------------------------*/
#define TRIAC_FIRE_TIME		        (2000ul/T1_TIME)			//triac fire time in task1 periods

/*----------------------------------------------------------------------------*/
/* Exported type                                                              */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Exported data                                                              */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Constant exported data                                                     */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/* Exported Macros                                                            */
/*----------------------------------------------------------------------------*/
/* Triac control */
#define _FIRE_TRIAC()(			        \
{								        \
    pinTH_FIRE = 1;					    \
    _set_triac_state(1);			    \
    _set_over_prot_triac_state(1);	    \
})	

#define _TRIAC_OFF()(			        \
{								        \
    pinTH_FIRE = 0;					    \
    _set_triac_state(0);			    \
})	

#define _TRIAC()			            pinTH_FIRE



/*----------------------------------------------------------------------------*/
/* Exported functions           				          				      */
/*----------------------------------------------------------------------------*/
void triac_fire_timer(void);
void triac_control_init(void);

#endif /* TRIAC_CONTROL_H */
